home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / libs / pdcurs21 / portable / mvwprint.c < prev    next >
C/C++ Source or Header  |  1993-06-18  |  3KB  |  86 lines

  1. #include <stdarg.h>
  2. #include <string.h>
  3. #define    CURSES_LIBRARY    1
  4. #include <curses.h>
  5. #undef    mvwprintw
  6.  
  7. #ifdef PDCDEBUG
  8. char *rcsid_mvwprint = "$Header: C:\CURSES\portable\RCS\mvwprint.c 2.1 1993/06/18 20:20:26 MH Rel MH $";
  9. #endif
  10.  
  11.  
  12.  
  13.  
  14.  
  15. /*man-start*********************************************************************
  16.  
  17.   mvwprintw()    - formatted write to a window
  18.  
  19.   X/Open Description:
  20.      The printw routine adds a string to the default window
  21.      starting at the current cursor position.  This routine causes
  22.      the string that would normally be output by printf to be
  23.      output by addstr.
  24.  
  25.      The routine wprintw adds a string to the specified window
  26.      starting at the current cursor position.  This routine causes
  27.      the string that would normally be output by printf to be
  28.      output by waddstr.
  29.  
  30.      The routine mvprintw adds a string to the default window
  31.      starting at the specified cursor position.  This routine
  32.      causes the string that would normally be output by printf to
  33.      be output by addstr.
  34.  
  35.      The routine mvwprintw adds a string to the specified window
  36.      starting at the specified cursor position.  This routine
  37.      causes the string that would normally be output by printf to
  38.      be output by waddstr.
  39.  
  40.      All these routines are analogous to printf.  It is advisable
  41.      to use the field width options of printf to avoid leaving
  42.      unwanted characters on the screen from earlier calls.
  43.  
  44.   PDCurses Description:
  45.      The old Bjorn Larssen code for the 68K platform has been removed
  46.      from this module.
  47.  
  48.   X/Open Return Value:
  49.      The mvprintw() function returns OK on success and ERR on error.
  50.  
  51.   X/Open Errors:
  52.      No errors are defined for this function.
  53.  
  54.   Portability:
  55.      PDCurses    int mvwprintw(WINDOW* win, int y, int x, char *fmt, ...)
  56.      X/Open Dec '88    int mvwprintw(WINDOW* win, int y, int x, char *fmt, ...)
  57.      BSD Curses    int mvwprintw(WINDOW* win, int y, int x, char *fmt, ...)
  58.      SYS V Curses    int mvwprintw(WINDOW* win, int y, int x, char *fmt, ...)
  59.  
  60. **man-end**********************************************************************/
  61.  
  62. int    mvwprintw(WINDOW * win, int y, int x, char *fmt, ...)
  63. {
  64.     int    retval = ERR;
  65.     va_list args;
  66.  
  67. #ifdef PDCDEBUG
  68.     if (trace_on) PDC_debug("mvwprintw() - called\n");
  69. #endif
  70.  
  71.     if (win == (WINDOW *)NULL)
  72.         return (retval);
  73.  
  74.     if (wmove(win, y, x) == ERR)
  75.         return (retval);
  76.  
  77.     va_start(args, fmt);
  78.     vsprintf(c_printscanbuf, fmt, args);
  79.     va_end(args);
  80.  
  81.     if (waddstr(win, c_printscanbuf) == ERR)
  82.         return (retval);
  83.     retval = (strlen(c_printscanbuf));
  84.     return (retval);
  85. }
  86.